<template>
	
		<u-popup :show="messageShow"  @touchmove.stop.prevent="moveHandle" mode="center" zIndex='99' overlayOpacity='0' duration="100">
			<view class="box-tk">
				
				<view class="view1" style="line-height: 45px ;text-align: center;" v-if="gifArray.iconCode">
					{{gifArray.title}}
					<image src="/static/img/icon-close.png"
						style="position: absolute; right: 11px; top: 11px;z-index: 89999;width: 24px;height: 24px" @click="close"></u-image>
				</view>
				<view class="xian"></view>
				<view class="box-xis">
					<view class="xis-title">
						<view class="xis-title_li">
							<text>房间号:{{gifArray.roomid}}</text>
							<text>床位号:{{gifArray.bedid}}</text>
						</view>
						<view class="">
							报警时间:{{gifArray.modifydate | formateDate}}
						</view>
					</view>
					<view class="box-img"></view>
					<view class="xis-hend">
						<image v-if="gifArray.title == '输液报警'"
							:src="gifArray.remark ? gifArray.remark.replace(/[\r\n]/g,'') :'/static/img/InfusionAlarm.jpg'"
							mode="aspectFit" :lazy-load="true" shape="square"></image>
						<image v-else-if="gifArray.title == '呼叫报警'"
							:src="gifArray.remark ? gifArray.remark.replace(/[\r\n]/g, '') :'/static/img/CallAlarm.jpg'"
							mode="aspectFit" :lazy-load="true" shape="square"></image>
					</view>
				</view>
				<view class="tk-heard">
					<u-button type="primary" text="取消" class="btn1" style="width: 100%;" color="#FF6E91"
						@click="cancelslitup"></u-button>
				</view>
			</view>
		</u-popup>
	
</template>

<script>
	import {
		mapMutations,
		mapState
	} from "vuex";
	import formateDate from '../js/day.js'
	export default {
		props: {
			checkitem: {
				type: String,
				default: ''
			}
		},
		computed: {
			...mapState('user', ['gifArray', 'messageShow','notifyObject']),
		},
		watch: {},
		data() {
			return {}
		},
		filters: {
			formateDate(time) {
				if (!time) return ''
				return formateDate(time).format('YYYY-MM-DD HH:mm:ss'); // 2011-10-17 00:17:56
			}
		},
		methods: {
			...mapMutations('user', ['set_messageShow','set_NOTIFY']),
			close() {
				this.set_messageShow(false)
			
			},
			moveHandle() {},
			cancelslitup() {
			
				try {
					uni.request({
						url: 'http://20.21.9.38:8022/smartcare/deviceOpt/optDevice', //接口地址。url
						method: "post", //传输类型
						data: {
							iconCode: this.gifArray?.iconCode,
							subType: this.gifArray?.title == '呼叫报警' ? 'pt_callsys' : 'iv_sys',
							opt: '03',
						}, //必要参数
						// header: data.header,	//https 请求头参数
						success: (res) => {
							if (res.data.success) {
							delete this.notifyObject[this.gifArray?.title == '呼叫报警' ? 'pt_callsys' : 'iv_sys'][ this.gifArray?.iconCode]
							this.set_NOTIFY(JSON.parse(JSON.stringify(this.notifyObject)))
								uni.showToast({
									title: '操作请求已发送',
									duration: 1000,
									icon: "success", //自定义显示的图标，默认成功success，错误error,加载loading，不显示图标是none
								});
								
							this.set_messageShow(false)
							}
						}
					});
				} catch (e) {
					//TODO handle the exception
				}
			},
		}
	}
</script>


<style scoped lang="scss">
	::v-deep .u-fade-enter-active {
		pointer-events: none !important;
	}
	
	::v-deep .u-fade-leave-active {
		pointer-events: none
	}
	.box-tk {
		width: 670rpx;
		// height: 212rpx;
		// background: #FFFFFF;
		border-radius: 8rpx;
		position: relative;
		padding-bottom: 20rpx;

		.view1 {
			font-size: 36rpx;
			font-family: SourceHanSansCN-Medium, SourceHanSansCN;
			font-weight: 500;
			color: #333333;
			height: 45px;
			// line-height: 45px;
			// text-align: center;
			white-space: break-spaces;
			padding: 0 6px;
			text-overflow: ellipsis;
			overflow: hidden;
		}

		.xian {
			position: absolute;
			width: 100%;
			height: 2rpx;
			background: #7AD9DF;
			left: 0;
			top: 96rpx;
			// opacity: 0.19;
			// opacity: 0.19;
			// margin: 14rpx 0;
		}

		.box-xis {
			width: 97%;
			// height: 262px;
			background: #B0E9EC;
			margin: 20rpx auto 0;
			padding-bottom: 12rpx;
			position: relative;
			border-radius: 12rpx;

			.box-img {
				position: absolute;
				right: 0;
				top: 0;
				width: 58px;
				height: 28px;
				background: url('.././../static/img/coagulation.svg') no-repeat;
				background-size: 100% auto;
				box-shadow: 3px -1px 8px 0px #D4D9D9;
			}

			.xis-title {
				// width: 100%;
				font-size: 16px;
				font-family: SourceHanSansCN-Normal, SourceHanSansCN;
				font-weight: 400;
				color: #333333;
				line-height: 24px;
				padding: 4px 6px;

				.xis-title_li {
					width: 80%;
					display: flex;
					justify-content: space-between;
				}
			}

			.xis-hend ::v-deep {
				// width: 303px;
				// height:300px;
				width: 96%;
				margin: 0 auto;
				// height: 228px;
				background: #F6FEFF;
				border-radius: 6px;
				opacity: 0.95;
				overflow-y: scroll;

				.u-image {
					width: 100% !important;
					height: 100% !important;

					.u-image__image {
						width: 100% !important;
					}
				}

				// text {
				// 	font-size: 32rpx;
				// 	font-family: SourceHanSansCN-Medium, SourceHanSansCN;
				// 	font-weight: 500;
				// 	color: #333333;
				// 	line-height: 48rpx;
				// }

				// .hend-title {
				// 	font-size: 32rpx;
				// 	font-family: SourceHanSansCN-Medium, SourceHanSansCN;
				// 	// font-weight: 500;
				// 	color: #333333;
				// 	line-height: 48rpx;
				// 	padding: 20rpx;

				// 	&:nth-child(-n+4) {
				// 		padding-bottom: 0;
				// 	}
				// }
			}
		}

		.tk-heard {
			display: flex;
			// height: calc(100% - 636rpx);
			align-items: center;
			margin: 16rpx auto 0;
			width: 97%;
		}

		.tk-heard ::v-deep {
			.u-button__text {
				font-size: 36rpx !important;
				font-family: SourceHanSansCN-Medium, SourceHanSansCN;
				font-weight: 500;
				color: #FFFFFF;
				line-height: 54rpx;
				letter-spacing: 28rpx;
			}
		}
	}

	.btn1 {
		box-shadow: 0px 2px 6px 0px #ff6e91;
	}
</style>
